package test2;

import java.util.List;

public class A2 {
    public static void main(String[] args) {
        College myCollege = new College("三峡大学");

        // 创建建筑
        Building building1 = new Building("J楼");
        Building building2 = new Building("L楼");

        // 将建筑添加到学院（聚合关系）
        myCollege.addBuilding(building1);
        myCollege.addBuilding(building2);

        // 创建课程
        Course course1 = new Course("软件工程");
        Course course2 = new Course("操作系统");

        // 将课程添加到学院（组合关系）
        myCollege.addCourse(course1);
        myCollege.addCourse(course2);

        // 获取学院的建筑和课程
        List<Building> collegeBuildings = myCollege.getBuildings();
        List<Course> collegeCourses = myCollege.getCourses();

        System.out.println("College: " + myCollege.getName());
        System.out.println("Buildings:");
        for (Building building : collegeBuildings) {
            System.out.println("  " + building.getName());
        }
        System.out.println("Courses:");
        for (Course course : collegeCourses) {
            System.out.println("  " + course.getName());
        }
    }
}







